package top.infopub.tdp.domain;


import java.util.Comparator;
import java.util.Set;
import java.util.TreeSet;

import top.infopub.generic.GenericEntity;
import top.infopub.model.sys.ParameterGroupDetail;
import top.infopub.model.sys.Parametergroup;


/**
 * 系统参数字典domain parameter_group_detail||parametergroup
 * @author Awoke
 * @version 2018年9月20日
 * @see DataDictDomain
 * @since
 */
public class DataDictDomain extends GenericEntity {

    private static final long serialVersionUID = -1017272421927344484L;

    private Parametergroup group = null;

    private Set<ParameterGroupDetail> dataDicDetails = new TreeSet<ParameterGroupDetail>(
        new Comparator<ParameterGroupDetail>() {
            @Override
            public int compare(ParameterGroupDetail o1, ParameterGroupDetail o2) {
                if (o1.getIsort() == null || o2.getIsort() == null) {
                    return -1;
                }
                if (o1.getIsort() > o2.getIsort()) {
                    return 1;
                }
                else {
                    return -1;
                }
            }

        });

    public Set<ParameterGroupDetail> getDataDicDetails() {
        return dataDicDetails;
    }

    public void setDataDicDetails(Set<ParameterGroupDetail> dataDicDetails) {
        this.dataDicDetails = dataDicDetails;
    }

    public void addDataDicDetail(ParameterGroupDetail detail) {
        dataDicDetails.add(detail);
    }

    public Parametergroup getGroup() {
        return group;
    }

    public void setGroup(Parametergroup group) {
        this.group = group;
    }

}
